<?
include("gestione/includes/config.inc.php");
include("gestione/includes/auth.lib.php");
include("gestione/includes/function.inc.php");
include("gestione/includes/product_new.class.php");
include("gestione/includes/e-commerce_new.class.php");
include("gestione/includes/news.class.php");
include("gestione/includes/content.class.php");
include("gestione/includes/keywords.class.php");
include("gestione/includes/class.xml.php");
$lang = "ita";
####################### TOYS #######################################################
$cid = 689;
$tiponews = "piscine";
$titvetrina = "tit-articoli-piscine-vetrina.gif";
$titcontent = "bkgTitCnt_piscine.gif";
$tipobanner = "piscine";
$titprodotti = '<img src="/images/titoli/tit-prodotti-piscine.gif" width="240" height="55">';
$titnovita = '<img src="/images/titoli/tit-novita-piscine.gif" width="200" height="55">';
$logo = '<img src="/images/loghi/bs-piscine.gif" width="99" height="100">';
$bgcolor = '#00A6E9';
####################### SESSION ##############################################################
$newSession = new websession();
$strNumArt = '<span class="ajax_cart_no_product">(vuoto)</span>';
$str_tot = 0;
if($newSession->order != NULL) {
	$articoli = $newSession->order->getArticoli();
	$numArt = count($articoli);
	$tot = $newSession->order->getTotale($articoli);
	$tot=="" ? $str_tot = 0 : $str_tot = number_format($tot,2,",",".");
	if($numArt>0) {
		$numArt>1 ?
		$strNumArt = '<span class="ajax_cart_quantity">'.$numArt.'</span> <span class="ajax_cart_product_txt">prodotti</span>' : 
		$strNumArt = '<span class="ajax_cart_quantity">'.$numArt.'</span> <span class="ajax_cart_product_txt">prodotto</span>';
	} else 
		$strNumArt = '<span class="ajax_cart_no_product">(vuoto)</span>';
}
if($newSession->getStatus())  {
	$registrati = '<li id="your_account"><a href="/webproduct.php?op=profile" title="Il tuo Profilo">Il tuo Profilo</a></li>
	<li id="header_user_info">
		Welcome '.$newSession->webuser->ragione.',
					(&nbsp;<a href="/webproduct.php?op=logout">Log out</a>&nbsp;)
			</li>';
	$tablelogin = '';
} else {
	$registrati = '<li id="your_account">&nbsp;</li>
	<li id="header_user_info">
		Welcome,
					(&nbsp;<a href="/webproduct.php?op=register">Login</a>&nbsp;)
			</li>';
}
####################################################################################################
$op = $_GET['op'];
if($op == "")
 $op = $_POST['op'];
$content = '<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						  <td width="20"><img src="/images/spacer.gif" width="20" height="36"></td>
						  <td width="470" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="3" class=plain>									
						  <tr>
			  <td width=100% class=tit01>Testimonianze dei nostri clienti</td>
			</tr>';
  switch($op)  {
    case "addFeed":
	  $content .= '<tr>
			  <td width=100% align=center>
				<table width=650 cellpadding=3 cellspacing=0 class=plain style="border:1px #EFEFEF solid">
				 <tr>
				  <td class=tit02 align=center>Lascia il tuo commento</td>
				 </tr>
				 <tr>
				  <td width=100%>
					<table width=650 class=plain cellpadding=3 cellspacing=0>
					   <form name=formfeed action=feedback.php method=POST>						
						<tr>
						 <td colspan=2>&nbsp;</td>
						</tr>
						<tr>
						 <td width=60 align=right>Nome:</td>
						 <td><input type=text id=name name=name value="'.$newSession->webuser->ragione.'"  size=50></td>
						</tr>
						<tr>
						 <td width=60 align=right valign=top>Giudizio:</td>
						 <td>
						 <table width=40>
						  <tr>
						   <td width=20><input type=radio name=voto value=negativo></td>
						   <td width=20><img src="/images/iconNeg_16x16.gif" alt=Negativo></td>
						  </tr>
						  <tr> 
						   <td width=20><input type=radio name=voto value=neutro></td>
						   <td width=20><img src="/images/iconNeu_16x16.gif" alt=Neutro></td>
						  </tr>
						  <tr> 
						   <td width=20><input type=radio name=voto value=positivo></td>
						   <td width=20><img src="/images/iconPos_16x16.gif" alt=Positivo></td>
						  </tr> 
						 </table>
						</tr>
						<tr>
						 <td align=right valign=top>Commento:</td>
						 <td valign=top><textarea id=testo name=testo cols=80 rows=10></textarea></td>
						</tr>
						<tr>
						 <td colspan=2>&nbsp;<input type=hidden name=op value=save>
						 </td>
						</tr>
						<tr>
						 <td colspan=2 align=center><input type=submit value=Invia onClick="return check_Voto();"></td>
						</tr>
						</form>
						</table>
				  </td>
				 </tr>
				</table>
			  </td>
			</tr>';
	break;
	
	case "save":
	 	$voto = $_POST['voto'];
		$testo = $_POST['testo'];
		$name = $_POST['name'];
		$feed = new feedback("",$name,0,$voto,$testo);
		$error = $feed->save();
		$content .= "<tr>
			  		<td width=100% align=center>
			    		<table width=650 border=0 cellpadding=0 cellspacing=0>
							<tr>
							 <td width=650 valign=top>
							  <table class=plain width=650 cellpadding=2><tr><td class=error align=\"center\"><b>$error</b><br><a class=plain href=\"feedback.php\">Guarda tutti i commenti</a></td>
							  </tr>
							  </table>
							  </td>
							</tr>
						</table>
					   </td>
						</tr>";
	break;
	
	default:
		$min = $_GET['min'];
		$max = $_GET['max'];
		$page = $_GET['page'];
		$tipo = $_GET['tipo'];
	  $thismonth = date("m");
	  		$jschart = 'var data = [
		{ label: "Positivo",  data: '.feedback::getStat("positivo","this").', color: "#007A0C"},
		{ label: "Neutro",  data: '.feedback::getStat("neutro","this").', color: "#5E8BC0"},
		{ label: "Negativo",  data: '.feedback::getStat("negativo","this").', color: "#F97A7A"}
	];
	$.plot($("#chart_1mese"), data, 
	{
		series: {
			pie: { 
				show: true,
				label: {
                    show: true,
                    radius: 1,
                    formatter: function(label, series){
                        return \'<div style="font-size:12px;text-align:center;padding:2px;">\'+label+\'<br/>\'+Math.round(series.percent)+\'%</div>\';
                    }
                }
			}
		},
		legend: {
			show: false
		}
	});
	var data = [
		{ label: "Positivo",  data: '.feedback::getStat("positivo","last6").', color: "#007A0C"},
		{ label: "Neutro",  data: '.feedback::getStat("neutro","last6").', color: "#5E8BC0"},
		{ label: "Negativo",  data: '.feedback::getStat("negativo","last6").', color: "#F97A7A"}
	];
	$.plot($("#chart_6mese"), data, 
	{
		series: {
			pie: { 
				show: true,
				label: {
                    show: true,
                    radius: 1,
                    formatter: function(label, series){
                        return \'<div style="font-size:12px;text-align:center;padding:2px;">\'+label+\'<br/>\'+Math.round(series.percent)+\'%</div>\';
                    }
                }
			}
		},
		legend: {
			show: false
		}
	});
	var data = [
		{ label: "Positivo",  data: '.feedback::getStat("positivo","tot").', color: "#007A0C"},
		{ label: "Neutro",  data: '.feedback::getStat("neutro","tot").', color: "#5E8BC0"},
		{ label: "Negativo",  data: '.feedback::getStat("negativo","tot").', color: "#F97A7A"}
	];
	$.plot($("#chart_totale"), data, 
	{
		series: {
			pie: { 
				show: true,
				label: {
                    show: true,
                    radius: 1,
                    formatter: function(label, series){
                        return \'<div style="font-size:12px;text-align:center;padding:2px;">\'+label+\'<br/>\'+Math.round(series.percent)+\'%</div>\';
                    }
                }
			}
		},
		legend: {
			show: false
		}
	});';
			$content .= '<tr>
			  <td width=100% align=center>
				<table width=650 cellpadding=3 cellspacing=0 class=plain style="border:1px #EFEFEF solid">
				 <tr>
				  <td colspan=3 class=tit02 align=center>Indice di gradimento</td>
				 </tr>
				 <tr>
				  <td width=210 align=center><div style="text-align:center;font-size:14px;font-weight:bold;">'.$mesi[$thismonth].'</div><div id="chart_1mese" class="graph" style="height:300px;"></div></td>
				  <td width=210 align=center><div style="text-align:center;font-size:14px;font-weight:bold;">Ultimi 6 mesi</div><div id="chart_6mese" class="graph" style="height:300px;"></div></td>
				  <td width=210 align=center><div style="text-align:center;font-size:14px;font-weight:bold;">Totale</div><div id="chart_totale" class="graph" style="height:300px;"></div></td>
				 </tr>
				</table>
			  </td>
			</tr>
			<tr>
			 <td width=100% align=center>
			  <a class=plain href="feedback.php?op=addFeed" style="font-size:14px;font-weight:bold;">Lascia un commento di feedback</a>
			 </td>
			</tr>
				 <tr>
					<td width=100% align=center>'.feedback::getFeedback("plain",$tipo,$min,$max,$page).'</td>
				 </tr>';
	break;
  }
  $content .= '</table>                      
			 </td>
			 <td width="20"><img src="/images/spacer.gif" width="20" height="36"></td>
						</tr>
					</table>';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="it" xmlns="http://www.w3.org/1999/xhtml"><head>
<? include("includes/header.php") ?>
</head>
<body>
<!--[if lt IE 7]><div style='clear:both;height:59px;padding:0 15px 0 15px;position:relative;z-index:10000;text-align:center;'><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://www.theie6countdown.com/images/upgrade.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a></div><![endif]-->
<div id="wrapper1">
<div id="wrapper2">
<div id="wrapper3">
	<!-- Header -->
<? include("includes/top.php")?>
	<div id="columns">
<!-- Left -->
<? include("includes/left.php")?>
<!-- Center -->
<div id="center_column" class="center_column">
<h1><?=$titolo?></h1>
<?=$navbar?>
<?=$content?>
</div>
		<div class="clearblock"></div>
	</div>
</div>
<!-- Footer -->
	<div id="footer_wrapper">
<? include("includes/footer.php")?>
	</div>
</div>
</div>
	</body></html>